package com.yunhe.energy.client;

import com.yunhe.energy.client.fallback.OptionFallbackFactory;
import com.yunhe.common.model.ResultObject;
import com.yunhe.common.model.data.Price;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.Date;
import java.util.List;

/**
 * @author liuronglei
 */
@FeignClient(value = "option", fallbackFactory = OptionFallbackFactory.class)
public interface OptionClient {
    /**
     * 根据条件获得价格列表
     * @param areaCode 地区代码
     * @param typeCode 类型代码
     * @param dtime 时间范围
     */
    @RequestMapping(value = "/prices", method = RequestMethod.GET)
    ResponseEntity<ResultObject<List<Price>>> getPrices(@RequestParam("areaCode") Long areaCode,
                                                        @RequestParam("typeCode") Long typeCode,
                                                        @RequestParam("dtime") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") List<Date> dtime);
}
